<include file="Public:header"/>
<style id="style1">
body{color:#232323}
.tt{font-weight:bold;background:#f1f7fc;}
.tt2{font-size:13px;height:20px;}
.title2{border-left-width: 1px; border-right-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px}
.list2{border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px}

.box{width:800px;margin:0 auto;margin-top:20px;font-size:15px}
</style>
<script language="javascript" src="__PUBLIC__/print/LodopFuncs.js"></script>
<script type="text/javascript" src="__PUBLIC__/code/jquery-barcode.min.js"></script>  
<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0> 
	<embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop32.exe"></embed>
</object> 

<!--订单状态 start-->
<div class="box">
<h2>A:订单状态</h2>
<switch name="order.pay_status" >
		<case value="1"><a href="javascript:pay({$order.order_id});"><font color="#008000">【已支付<img alt="已支付" src="__APP__/statics/infosuccess.gif" height="15"/>】</font></a></case>
		<case value="10">【部分支付】</case>
		<default />【未支付<img alt="未支付" src="__APP__/statics/infoerror.gif" height="15"/>】
</switch>

<switch name="order.ship_status" >
		<case value="1"><a href="javascript:;" onclick="shipping({$order.order_id})"><font color="#008000">【已配送<img alt="已配送" src="__APP__/statics/infosuccess.gif" height="15"/>】</font></a></case>
		<default />【未配送<img alt="未配送" src="__APP__/statics/infoerror.gif" height="15"/>】
</switch>
</div>
<!--订单状态 end-->

<!--订单商品 start-->
<div id="orderlist" >
<div class="box">
<div style="width:150px;float:left"><h2>B:订单商品</h2></div><div style="width:300px;float:right;margin-right:30px" id="kk"></div>
<table border="0" width="800px" style="border-collapse: collapse">
	<tr class="tt">
	    <td class="title2">编号</td>
		<td class="title2">货号</td>
		<td class="title2">商品</td>
		<td class="title2">规格</td>
		<td class="title2">单价</td>
		<td class="title2" align="center">数量</td>
		<td class="title2">小计</td>
	</tr>
<volist name="orderlist" id="list">
	<tr class="tt2">
	    <td class="list2">{$i}</td>
		<td class="list2">{$list.bn}</td>
		<td class="list2"><a href="__APP__/Goods/item/id/{$list.goods_id}" target="_blank">{$list.name}</a></td>
		<td class="list2"><font color="red">{$list.props}</font></td>
		<td class="list2">{$list.price}</td>
		<td class="list2" align="center">{$list.num}</td>
		<td class="list2">{$list.amount}</td>
	</tr>
</volist>

	<tr>
		<td>　</td>
		<td>　</td>
		<td>　</td>
		<td>　</td>
		<td>　</td>
		<td valign="top" align="right">+商品金额：<br>+运费：<br>-优惠金额：<br><b>订单总额：</b><br>已付金额：</td>
		<td valign="top">{$order.total_money}<br>{$order.dly_money}<br>
		{$order.pmt_money}<br><b>{$order.final_money}</b><br>{$order.payed}</td>
	</tr>

	</table>
</div>
<!--订单商品 end-->

<!--收货信息 start-->
<div class="box">
<h2>C:收货信息</h2>

<table border="1" width="800px" id="table1" style="border-collapse: collapse; border: 3px double #C0C0C0; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px" bordercolor="#CCCCCC">
	<tr>
		<td width="15%">收货人姓名：</td>
		<td width="15%">{$order.ship_name}</td>
		<td width="12%">送货时间：</td>
		<td width="22%">{$order.ship_time}</td>
		<td width="10%">会员账号：</td>
		<td width="18%">{$user.uname}({$user.member_id})</td>
	</tr>
	<tr>
		<td width="15%">联系方式：</td>
		<td width="15%">{$order.ship_mobile}</td>
		<td width="12%">订单留言：</td>
		<td width="53%" colspan="3">{$order.leave_msg}</td>
	</tr>
	<tr>
		<td width="15%">地址：</td>
		<td colspan="5">{$order.ship_addr}</td>
	</tr>
</table>
</div>

</div>
<!--收货信息 end-->
<br><br><br>

<div id="save">
<switch name="order.status">
      <case value="active">
	     <if condition="$order.pay_status eq 0">
		     <input onclick="setpay({$order.order_id})" type="button" value="支付">
		<else/>
		     <input onclick="setpay({$order.order_id})" disabled="true" type="button" value="支付">
		</if>

		<if condition="$order.ship_status eq 0">
		     <input onclick="setship({$order.order_id})" type="button" value="发货">
		<else/>
		     <input onclick="setship({$order.order_id})" disabled="true" type="button" value="发货">
		</if>
			 <input onclick="finish({$order.order_id})" type="button" value="完成">
			 <input onclick="cancel({$order.order_id})" type="button" value="作废">
		</case>
	  <default/>
	         <input onclick="setpay({$order.order_id})" disabled="true" type="button" value="支付">
			 <input onclick="setship({$order.order_id})" disabled="true" type="button" value="发货">
			 <input onclick="finish({$order.order_id})" disabled="true" type="button" value="完成">
			 <input onclick="cancel({$order.order_id})" disabled="true" type="button" value="作废">
</switch>
<input onclick="print()" type="button" value="打印">
</div>

<script src="__APP__/statics/webox/webox.js"></script>
<link href="__APP__/statics/webox/jquery-webox.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
$("#kk").barcode('{$order.order_id}', "code128",{barWidth:2, barHeight:30}); 
//配送记录
function shipping(t){
       var id=t;
		$.webox({
			height:150,
			width:250,
			bgvisibel:true,
			title:'配送信息',
			iframe:'__URL__/doc_ship/?order='+id
		});
}
//支付记录
function pay(t){
       var id=t;
		$.webox({
			height:200,
			width:350,
			bgvisibel:true,
			title:'订单支付记录',
			iframe:'__URL__/doc_pay/?order='+id
		});
}

function setpay(t){
       var id=t;
		$.webox({
			height:300,
			width:700,
			bgvisibel:true,
			title:'支付处理',
			iframe:'__URL__/setpay/?action=pay&order='+id
		});
}

function setship(t){
       var id=t;
		$.webox({
			height:300,
			width:700,
			bgvisibel:true,
			title:'发货处理',
			iframe:'__URL__/setship/?action=ship&order='+id
		});
}

//完成订单
function finish(t){
	if(confirm('你确定要完成此订单吗？订单完成后将不能进行任何操作！请核实支付、配送是否完成')) {
		var id=t;
		$.ajax({
				 type:'GET',
				 url:'__URL__/set/?action=finish',
				 dataType:'html',
				 data:{'id':id},
				 success:function(){
				   location.reload();
				 }
			})
	}
}
//取消订单
function cancel(t){
	if(confirm('你确认作废此订单吗？订单作废后将不能进行任何操作！')) {
		var id=t;
		$.ajax({
				 type:'GET',
				 url:'__URL__/set/?action=dead',
				 dataType:'html',
				 data:{'id':id},
				 success:function(){
				   location.reload();
				 }
			})
	}
}

function print(){
        var LODOP;
	    LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));  
		var strBodyStyle="<style>"+document.getElementById("style1").innerHTML+"</style>";
		var strFormHtml=strBodyStyle+"<body>"+$("#orderlist").html()+"</body>";
		LODOP.SET_PRINT_STYLE("Bold",1);
		LODOP.SET_PRINT_PAGESIZE(2,"","","A5");
		LODOP.ADD_PRINT_HTM(10,5,1000,600,strFormHtml);
		var res=LODOP.PRINT();	
}
</script>